<?php
if (!defined('INDEX')) {
	exit ('Access Denied');
}

$parameter=act_wap_list();
extract($parameter);
include(TPLPATH.'/inc/header_2.tpl.php');?>
<script>
var floorStep=2;
var ajaxTag=0;
$(function(){
	$(window).bind('scroll',function(){
		if($(window).scrollTop()+$(window).height()>=$(document).height()-400){
			if(ajaxTag==0){
				ajaxTag=1;
				jiazai(floorStep);
				floorStep++;
			}
		}
	});
	$('.shuju_load img.lazy').lazyload({
		threshold:20,
		failure_limit:50
	});
});

function index_tpl(){/* <li> <a href="{$url}"><span class="tupian"> <img data-original="{$img}" title="{$title}" class="lazy" src="<?=$dd_tpl_data['loading_img']?>" alt="{$title}"/> </span>    <span class="biaoti">{$title}</span><span class="jiage"><span>￥</span>{$zk_final_price}<del>{$reserve_price}</del></span>
			<span class="fanli" style="float:right; text-align:right; margin-right:10px;margin-top:-12px"><font color="#FF6600">{$rebate_word}</font></span>
                    </a> </li><li style="width:2%; background:#F0F0F0"></li>*/;}

function jiazai(floorStep){	
	$('.chakan_more').text('数据获取中……');
	var url='<?=wap_l(MOD,ACT)?>&q='+'<?=$q?>'+'&page='+floorStep;
	$.getJSON(url,function(data){
		ajaxTag=0;
		if(data.s=='1'){
			if(data.r=='' || data.r=='null' || data.r==null){
				alert('没有了');
				ajaxTag=1;
				$('.chakan_more').hidden();
			}else{
				for(i in data.r){
					row=data.r[i];
					var html=getTplObj(index_tpl,row);
					$('.shuju_load').append(html);
				}
				$('.chakan_more').text('点击更多');
				$('.shuju_load img.lazy').lazyload({
					threshold:20,
					failure_limit:50
				});
			}
		}
	});
}
</script>
<div class="yingdao" align="center" >
  <p><b><?=$q?></b><a href="javascript:;" onclick="history.back()" title="返回" class="left"></a> </p></div>  
    	
 </div> 


  <div class="p5">
    <ul class="remai2 shuju_load">
		 	  <?php foreach($shuju_data as $k=>$row){?>
		       <li> <a href="<?=$row['url']?>"> 
		            <span class="tupian"> <img data-original="<?=tb_img($row['img'],200)?>" title="<?=$row['title']?>" class="lazy" src="<?=$dd_tpl_data['loading_img']?>" alt="<?=$row['title']?>"/> </span>                    <span class="biaoti"><?=$row['title']?></span>
                         <span class="jiage">
		                     <span>￥</span><?=$row['zk_final_price']?> 
		                     <del><?=$row['reserve_price']?></del>
		                 </span>
                 <span class="fanli" style="float:right; text-align:right; margin-right:10px;margin-top:-12px"><font color="#FF6600"><?=$row['rebate_word']?></font></span>
                       
                    </a> </li><li style="width:2%; background:#F0F0F0"></li>
             <?php }?>
			 </ul>
			
<a class="chakan_more">下拉加载更多</a></div> 
  <a href="javascript:scroll(0,0)" hidefocus="true" title="回到顶部" id="scrollTop"></a>
  
<?php include(TPLPATH.'/inc/tdj.tpl.php');?>
<?php include(TPLPATH.'/inc/footer.tpl.php');?>